import request from '@/utils/request'
import {DeleteRequest, ListRequest, ResetPasswordRequest, User, UserStatusRequest} from '@/interface/user'

export const UserListR = (req: ListRequest) => {
  return request({
    method: 'GET',
    url: '/user',
    params: req,
  })
}

//添加用户
export const UserAddR = (req: User) => {
  return request({
    method: 'POST',
    url: '/user',
    data: JSON.stringify(req),
  })
}

//删除用户
export const UserRemoveR = (req:DeleteRequest) => {
  return request({
    method: 'DELETE',
    url: `/user`,
    params: req
  })
}

//修改用户状态
export const UserStatusR = (req: UserStatusRequest) => {
  return request({
    method: 'PATCH',
    url: '/user/status',
    data: JSON.stringify(req),
  })
}

//重置用户密码
export const ResetPasswordR = (req: ResetPasswordRequest) => {
  return request({
    method: 'PATCH',
    url: '/user/password',
    data: JSON.stringify(req),
  })
}

//修改用户
export const UserUpdateR = (req: User) => {
  return request({
    method: 'PUT',
    url: '/user',
    data: JSON.stringify(req),
  })
}

//用户菜单列表
export const UserMenuListR = () => {
  return request({
    method: 'GET',
    url: '/user/menu',
  })
}